const express = require("express");
const app = express()
const path = require("path")
const bodyParser = require('body-parser')
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({extended: false}))
app.engine('html', require('express-art-template'));


//设置views对应的路径
app.set('views', path.join("./page/crud"));
app.use("/node_modules/", express.static(path.join('./node_modules')))

app.use("/page/", express.static(path.join('./page')))

const router = require("./testCurd")
//将路由挂载到服务器
app.use(router)

app.use(function (req,res) {
    //所有未配置的请求都会加载到这里
    res.send("404")
})


app.listen(9000, function () {
    console.log("server is start...");
})

module.exports=app